package com.xls.box2023.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lzz.bottomencapsulation.holder.MvpRVViewHolder;
import com.xls.box2023.R;
import com.xls.box2023.entity.JiFenTiXianBiliEntity;

import java.text.DecimalFormat;

public class DuiHuanJinBiBiLiItemView extends MvpRVViewHolder<JiFenTiXianBiliEntity> {
    private TextView bili_level;
    private TextView bili_bili;
    private LinearLayout bili_ll;

    public DuiHuanJinBiBiLiItemView(Context context, ViewGroup p) {
        super(R.layout.item_duihuanjinbi_bili, context, p);
    }

    @Override
    public void initView() {
        bili_level = itemView.findViewById(R.id.bili_level);
        bili_bili = itemView.findViewById(R.id.bili_bili);
        bili_ll =  itemView.findViewById(R.id.bili_ll);
        bili_level.setText(viewData.getLevel()+"级");
        DecimalFormat b = new DecimalFormat("0.0");
        String format = b.format(Double.parseDouble(viewData.getExchangeRate()));
        String jinbi="10000 元宝 = "+format+" 金币";
        bili_bili.setText(jinbi);
        if (getLayoutPosition()%2>0){
            bili_ll.setBackgroundColor(Color.parseColor("#5EA6F6"));
        }else {
            bili_ll.setBackgroundColor(Color.parseColor("#2188F8"));
        }

    }
}
